﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cilada.TestLib
{
    class TBaseClass 
    { 
        public int PID { get; set; }
    }

    class ExtendedTBaseClass : TBaseClass
    {
    }

    class GenericClass<T>
        where T : TBaseClass
    {
        public T SomeProperty { get; set; }

        void TestMethod1(T param)
        { }

        T TestMethod2()
        { return default(T); }
    }

    class NonGenericSubclass : GenericClass<ExtendedTBaseClass>
    {
    }

    class MultiGenericClass<T,U> : GenericClass<T>
        where T : TBaseClass
        where U : new()
    {
        public U GetSomeInstance(T t, string s)
        {
            U x = new U();
            t.PID += 5;
            return x;
        }
    }

    class GenericTestingClass
    {
        GenericClass<ExtendedTBaseClass> TProperty { get; set; }

        public GenericTestingClass()
        {
            MultiGenericClass<TBaseClass, NonGenericSubclass> x = new MultiGenericClass<TBaseClass, NonGenericSubclass>();
            NonGenericSubclass s = x.GetSomeInstance(new TBaseClass(), "testing");
        }
    } 
}
